// this is bad
// better one is the resizing array stack
public class FixedCapacityStackOfStrings {
    private String[] s;
    private int N = 0;

    // a cheatful parameter (shouldn't have capacity decided by customer)
    public FixedCapacityStackOfStrings(int capacity) {
        s = new String[capacity];
    }

    public boolean isEmpty() {
        return N == 0;
    }

    public void push(String item) {
        s[N++] = item;
    }

    public String pop() {
        if (isEmpty()) return null;
        String item = s[--N];
        s[N] = null; // avoids memory leak (loitering)
        return item;
    }
}
